<{include file="public/header" /}>
<body>

<div style="padding: 10px; background-color: #F2F2F2;padding-bottom: 150px">
  <form class="layui-form layui-form-pane" >
  	<div class="layui-card">
  		<!-- <div class="layui-card-header">请毕业生如实认真填写</div> -->
  		  <div class="layui-card-body">

  			  <div class="layui-form-item">
  			    <label class="layui-form-label">考试标题：</label>
  			    <div class="layui-input-block">
  			      <input type="text" name="title" autocomplete="off" placeholder="考试大标题" class="layui-input" lay-verify="required">
  			    </div>
  			  </div>

          <div class="layui-form-item">
            <label class="layui-form-label">考试说明：</label>
            <div class="layui-input-block">
              <input type="text" name="description" autocomplete="off" placeholder="考试小标题" class="layui-input" >
            </div>
          </div>

          <div class="layui-form-item">
            <label class="layui-form-label">总分：</label>
            <div class="layui-input-block">
              <input type="text" name="totalscore" autocomplete="off" placeholder="总分" class="layui-input" lay-verify="number">
            </div>
          </div>

         <div class="layui-form-item">
            <label class="layui-form-label">科目：</label>
            <div class="layui-input-block">
              <select name="subject"  lay-verify="required">
                <option value="<{$Think.session.subject}>"><{$Think.session.subject|get_question_subject}></option>
                <!-- <option value="1">语文</option>
                <option value="2">数学</option>
                <option value="3">英语</option>
                <option value="4">物理</option>
                <option value="5">化学</option>
                <option value="6">生物</option>
                <option value="7">政治</option>
                <option value="8">历史</option>
                <option value="9">地理</option> -->
              </select>
            </div>
          </div>

          <div class="layui-form-item">
            <label class="layui-form-label">开始时间：</label>
            <div class="layui-input-block">
                <input type="text" name="begintime" autocomplete="off" placeholder="考试开始时间" class="layui-input" id="starttime">
            </div>
          </div>
            
          <div class="layui-form-item">
            <div class="layui-collapse">
              <div class="layui-colla-item">
                <h2 class="layui-colla-title" style="background-color: #fff;">允许班级参考班级：</h2>
                <div class="layui-colla-content">
                  <{volist name="classes" id="vo"}>
                  <input type="checkbox" name="cids[]" title="<{$vo.title}>" lay-skin="primary" value="<{$vo.cid}>">
                  <{/volist}>
                  
                </div>
              </div>
            </div>
          </div>
          
          <!-- <div class="layui-form-item">
            <label class="layui-form-label">允许班级：</label>
            <div class="layui-input-block">
              <input type="checkbox" name="class[]" title="写作" lay-skin="primary" checked>
              <input type="checkbox" name="class[]" title="写作" lay-skin="primary" checked>
            </div>
          </div> -->

          <div class="layui-form-item">
            <label class="layui-form-label">考试时长：</label>
            <div class="layui-input-block">
              <input type="text" name="timelong" autocomplete="off" placeholder="分钟" class="layui-input" lay-verify="number">
            </div>
          </div>
          
          <div class="layui-form-item">
            <label class="layui-form-label">考试次数：</label>
            <div class="layui-input-block">
              <input type="text" name="subnum" autocomplete="off" placeholder="允许学生提交次数，默认1次" class="layui-input" lay-verify="number">
            </div>
          </div>

         
  			
  		</div>
  	 </div>
    <div class="layui-card" style="padding-top: 15px;">
      <!-- <div class="layui-card-header">卡片面板</div> -->
      <div class="layui-card-body">

        <div class="layui-form-item">
            <!-- <input type="hidden" name="subject"  value="<{$Think.session.subject}>"> -->
            <input type="hidden" name="tid"  value="<{$Think.session.uid}>">
        </div>
        <div class="layui-form-item">
            <button class="layui-btn layui-btn-fluid" lay-submit="" type = "button" lay-filter="demo2" id="demo2">提交</button>
        </div>
      </div>
    </div>
  </form>
</div>



<script>

layui.use(['form','element','layer','jquery','laydate'], function(){
  var $ = layui.$
  ,form = layui.form,element = layui.element,layer = layui.layer,laydate = layui.laydate;
  //----------上面引入layui下面开始业务，分割一下-----------------//
   //日期组件
  laydate.render({
      elem: '#starttime'//指定元素
      ,type: 'datetime'
      ,trigger: 'click'
    });
   //监听表单提交
  form.on('submit(demo2)', function(data){
    // layer.alert(JSON.stringify(data.field), {
    //   title: '最终的提交信息'
    // })
        layer.confirm('确定提交?', {btn: ['提交','取消'],icon: 3, title:'提示'}
        ,function(index){
          //do something
            $.post("<{:url('do_add')}>",data.field,function(data,status){
              //alert(data);
              //alert(JSON.stringify(data));
              //console(data);
              if(data===1){
                layer.msg('提交成功!',{icon: 6,time:1000},function(index){
                   x_father_close();
                   parent.location.reload();
                });
                
              }else{
                layer.alert(data,function(index){
                  layer.close(index);
                }); 
              }
           })
          
        }
      );
     
    
  });
  
});
//删除 预览图片需要加载jquery    
// function deleteImg(obj){
//             obj.parent('.imglist').remove();
//             //var aa=$('div');
//             //aa.remove('#imglist');
// }

</script>


</body>
</html>